package com.bwie.redkids.fragment;

import com.bwie.redkids.CollectionActivity;
import com.bwie.redkids.LoginActivity;
import com.bwie.redkids.R;
import com.bwie.redkids.widgt.SlidingMenuWidget;
import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu;

import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;

public class MoreFragment extends Fragment implements OnClickListener {
	private Button image_person_fragment_login;
	private ImageView iv_setting;
	private FragmentActivity activity;
	private TextView tv_collect;

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		View view = inflater.inflate(R.layout.more_fragment, null, false);
		activity = getActivity();
		initView(view);

		return view;
	}

	private void initView(View view) {
		image_person_fragment_login = (Button) view
				.findViewById(R.id.image_person_fragment_login);
		iv_setting = (ImageView) view.findViewById(R.id.iv_setting);
		tv_collect = (TextView) view.findViewById(R.id.tv_collect);
		iv_setting.setOnClickListener(this);
		image_person_fragment_login.setOnClickListener(this);
		tv_collect.setOnClickListener(this);
	}

	@Override
	public void onClick(View v) {
		switch (v.getId()) {
		case R.id.image_person_fragment_login:
			Intent intent = new Intent(activity, LoginActivity.class);
			startActivity(intent);
			break;
		case R.id.iv_setting:
			SlidingMenu menu = SlidingMenuWidget.getSlidingMenu(activity);
			menu.showMenu();
			break;
		case R.id.tv_collect:
			Intent intent2 = new Intent(getActivity(), CollectionActivity.class);
			startActivity(intent2);
			break;
		default:
			break;
		}
	}

}
